#include "csapp.h"
#include <time.h>

void echo(int connfd)
{
    
    size_t n; 
    char buf[MAXLINE]; 
    rio_t rio;
    time_t ticks = time(NULL);

    Rio_readinitb(&rio, connfd);
    while((n = Rio_readlineb(&rio, buf, MAXLINE)) != 0) {
    /*printf("server received %d bytes\n", n);*/
        printf("server received %d bytes\n，%s",n,buf);
        printf("服务器实现人：20155203杜可欣\n当前时间：%.24s\r\n",ctime(&ticks));
        snprintf(buf,MAXRECVLEN,"当前时间：%.24s\r\n",ctime(&ticks));
    Rio_writen(connfd, buf, n);
    }



}
